Decline Company Ticket by ID
The Decline Company Ticket by ID API displays the status that the company chosen for approval is declined successfully.
Method: POST
{{URL}}/jsonrpc
Headers
Name | Value |
---|---|
Content-Type | application/json |
Example
Payload Parameters
Parameter | Description |
---|---|
id Mandatory | String Unique ID for each request |
jsonrpc | String JSON RPC VERSION - should be "2.0" |
method Mandatory | String Method Name - should be "VisaService.DeclineTicket" |
params Mandatory | Object |
api Mandatory | Object |
credential Mandatory | String API credential provided by NetXD |
signature Mandatory | String Signature of the digitally signed payload |
payload Mandatory | Object |
id (or) companyId Mandatory | String Ticket Id or Company Id to be declined "id" is mandatory if "companyId" is not provided "companyId" is mandatory if "id" is not provided |
notes Optional | String Reason for declining or any other notes, if required |
- cURL
- C#
- Go
- NodeJs
curl --location --globoff '{{URL}}/jsonrpc' \
--header 'Content-Type: application/json' \
--data '{"id":"1","jsonrpc":"2.0","method":"VisaService.DeclineTicket","params":{"api":{"credential":"Basic cy5wYXJhbWVzd2FyYW5AYmFua2Nidy5vcmc6VGVzdEAxMjM0","signature":"MEQCIB50i5KBEVl4iK4SzNyKBqx4jCzB/28mMVNpsWGT69H0AiArVib+De0hEpGvEfo/RY0X7alFUI2vYr48+thrUAB7kw=="},"payload":{"id":"65df3e61bc2422fb17c9755c","notes":"declined"}"payload":{"companyId":"65df3e61bc2422fb17c9755c","notes":"declined"}}}'
var options = new RestClientOptions("{{URL}}/jsonrpc")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@" ""id"": ""1"",
" + "\n" +
@" ""jsonrpc"": ""2.0"",
" + "\n" +
@" ""method"": ""VisaService.DeclineTicket"",
" + "\n" +
@" ""params"": {
" + "\n" +
@" ""api"": {
" + "\n" +
@" ""credential"": ""Basic cy5wYXJhbWVzd2FyYW5AYmFua2Nidy5vcmc6VGVzdEAxMjM0"",
" + "\n" +
@" ""signature"": ""MEQCIB50i5KBEVl4iK4SzNyKBqx4jCzB/28mMVNpsWGT69H0AiArVib+De0hEpGvEfo/RY0X7alFUI2vYr48+thrUAB7kw==""
" + "\n" +
@" },
" + "\n" +
@" ""payload"": {
" + "\n" +
@" ""id"": ""65df3e61bc2422fb17c9755c"",
" + "\n" +
@" ""notes"": ""declined""
" + "\n" +
@" }
" + "\n" +
@" " + "\n" +
@" ""payload"": {
" + "\n" +
@" ""companyId"": ""65df3e61bc2422fb17c9755c"",
" + "\n" +
@" ""notes"": ""declined""
" + "\n" +
@" }
" + "\n" +
@" }
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "{{URL}}/jsonrpc"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"id": "1",`+"
"+`
"jsonrpc": "2.0",`+"
"+`
"method": "VisaService.DeclineTicket",`+"
"+`
"params": {`+"
"+`
"api": {`+"
"+`
"credential": "Basic cy5wYXJhbWVzd2FyYW5AYmFua2Nidy5vcmc6VGVzdEAxMjM0",`+"
"+`
"signature": "MEQCIB50i5KBEVl4iK4SzNyKBqx4jCzB/28mMVNpsWGT69H0AiArVib+De0hEpGvEfo/RY0X7alFUI2vYr48+thrUAB7kw=="`+"
"+`
},`+"
"+`
"payload": {`+"
"+`
"id": "65df3e61bc2422fb17c9755c",`+"
"+`
"notes": "declined"`+"
"+`
}`+"
"+`
"payload": {`+"
"+`
"companyId": "65df3e61bc2422fb17c9755c",`+"
"+`
"notes": "declined"`+"
"+`
}`+"
"+`
}`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': '{{URL}}',
'path': '/jsonrpc',
'headers': {
'Content-Type': 'application/json'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = "{\r\n \"id\": \"1\",\r\n \"jsonrpc\": \"2.0\",\r\n \"method\": \"VisaService.DeclineTicket\",\r\n \"params\": {\r\n \"api\": {\r\n \"credential\": \"Basic cy5wYXJhbWVzd2FyYW5AYmFua2Nidy5vcmc6VGVzdEAxMjM0\",\r\n \"signature\": \"MEQCIB50i5KBEVl4iK4SzNyKBqx4jCzB/28mMVNpsWGT69H0AiArVib+De0hEpGvEfo/RY0X7alFUI2vYr48+thrUAB7kw==\"\r\n },\r\n \"payload\": {\r\n \"id\": \"65df3e61bc2422fb17c9755c\",\r\n \"notes\": \"declined\"\r\n }\r\n \n \"payload\": {\r\n \"companyId\": \"65df3e61bc2422fb17c9755c\",\r\n \"notes\": \"declined\"\r\n }\r\n }\r\n}";
req.write(postData);
req.end();
Body
{
"id": "1",
"jsonrpc": "2.0",
"method": "VisaService.DeclineTicket",
"params": {
"api": {
"credential": "Basic cy5wYXJhbWVzd2FyYW5AYmFua2Nidy5vcmc6VGVzdEAxMjM0",
"signature": "MEQCIB50i5KBEVl4iK4SzNyKBqx4jCzB/28mMVNpsWGT69H0AiArVib+De0hEpGvEfo/RY0X7alFUI2vYr48+thrUAB7kw=="
},
"payload": {
"id": "65df3e61bc2422fb17c9755c",
"notes": "declined"
}
//or
"payload": {
"companyId": "65df3e61bc2422fb17c9755c",
"notes": "declined"
}
}
}
Response: 201
Response Parameters
Parameter | Description |
---|---|
jsonrpc | String JSON RPC VERSION - should be "2.0" |
result | Object |
message | String Status of Ticket decline |
id | String Unique ID for each response |
{
"jsonrpc": "2.0",
"result": {
"message": "Ticket declined successfully"
},
"id": "1"
}